<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class ProductCategory extends Model
{
    //
    protected $table = 'product_categories';

    protected $fillable = [
        'bistro_id', 'name'
    ];

    public function scopeName($query, $name) {
        if(!empty($name)) {
            return $query->where('name', 'like', '%'.$name.'%');
        }
    }

    public function product() {
        return $this->hasMany('\App\Model\Product');
    }
}
